package com.hifar.test.api.config;

import com.hifar.test.api.auth.BasicAuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 认证配置类
 * 配置Basic认证拦截器
 */
@Configuration
public class AuthConfig implements WebMvcConfigurer {
    
    @Autowired
    private BasicAuthInterceptor basicAuthInterceptor;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(basicAuthInterceptor)
                .addPathPatterns("/api/busi/test/api/data-receiver/**")
                .excludePathPatterns("/api/busi/test/api/data-receiver/health")
                .excludePathPatterns("/api/busi/test/api/data-receiver/info");
    }
}
